<?php

class Kowcore_View_Helper_MapData extends Zend_View_Helper_Abstract {
	
	protected $_name;
	
	public function mapData($items) {
		if (! ($items instanceof Engine_Db_Table_Rowset) && ! ($items instanceof Zend_Paginator)) {
			return array ();
		}
		
		$mapInfo = array ();
		foreach ( $items as $item ) {
			if (! $item->country && ! $item->city && ! $item->state) {
				continue;
			}
			$mapInfo [] = array ('latitude' => $item->latitude, 'longitude' => $item->longitude, 'title' => $item->getTitle (), 'href' => $item->getHref (), 'info' => $this->view->markerInfo ( $item ) );
		}
		
		return $mapInfo;
	}

}